<template>
  <div class="transportWrap">
    <div class="wrapCont">
      <!-- <a href="javascript:;" @click="toChange(30)">30承运商</a><br>
      <a href="javascript:;" @click="toChange(40)">40司机</a> -->
      <!-- <button @click="setWaybill(40)">aaaaaaaaaa</button>
      <button @click="setWaybill(30)">bbbbbbbb</button> -->
      <div class="header">
        <ul class="clearfix" v-show="userType == 30">
          <li v-for="item in statusList" :ref="item.class" @click='onStatus(item.status)' :key="item.status">
            <p :class="{'active': statusActive == item.status}">{{item.txt}} <span v-show="item.status != '0'">({{item.count}})</span></p>
            <i v-show="statusActive == item.status"></i>
          </li>
        </ul>
        <ul class="clearfix" v-show="userType == 40">
          <li class="driverLi" v-for="item in statusListDriver" :ref="item.class" @click='onStatus(item.status)' :key="item.status">
            <p :class="{'active': statusActive == item.status}">{{item.txt}} <span v-show="item.status != '0'">({{item.count}})</span></p>
            <i v-show="statusActive == item.status"></i>
          </li>
        </ul>
      </div>
      <swiper :options="swiperOption" ref="mySwiper">
        <swiper-slide  v-for="item in statusListAll" :key="item.status" >
            <div class="main-body" ref="wrapper" :style="{'height':wrapperHeight+'px'}">
              <mt-loadmore :top-method="loadTop" @top-status-change="handleTopChange" :bottom-method="loadBottom" :bottom-all-loaded="allLoaded" :bottomPullText='bottomText' ref="loadmore">
                <mt-swiper-trans-slide-cont :child-list="userType == 30?list[item.status]:listDrav[item.status]" v-on:transBillId="childRes"></mt-swiper-trans-slide-cont>
                <div slot="top" class="mint-loadmore-top">
                    <span v-show="topStatus !== 'loading'" :class="{ 'rotate': topStatus === 'drop' }">↓</span>
                    <span v-show="topStatus === 'loading'">正在刷新...</span>
                </div>
              </mt-loadmore>
            </div>
            <div class="mailingAddress" v-show="item.status == 68">
              <span>邮寄地址 : </span>
              <i>上海市虹口区曲阳路910号1410室</i>
            </div>
        </swiper-slide>
      </swiper>
      <!-- <div class="contant" v-infinite-scroll="loadMore" infinite-scroll-disabled="busy" infinite-scroll-distance="10">
        <div class="offerList" v-for="(item, index) in list" :key="index">
          <div class="singerBox">
            <div class="boxTitle clearfix">
              <div class="left fl">运单号：{{item.transBillId}}</div>
              <div class="right fr" v-show="userType == 30">{{item.transBillStatusName}}</div>
              <div class="right fr date" v-show="userType == 40">{{item.createDate}}</div>
            </div>
            <div class="addressList" v-for="(addressItem,indexs) in item.addrres" :key="indexs">
              <div class="address clearfix">
                <span class="fl add">{{addressItem.beginSiteProvince | city}}</span>
                <span class="iconTo">&nbsp;</span>
                <span class="fr add">{{addressItem.endSiteProvince | city}}</span>
              </div>
            </div>
            <div class="border">
              <i class="halfLe"></i>
              <i class="halfRi"></i>
            </div>
            <div class="info">
              <div class="up clearfix">
                <div class="left fl">总重量：{{item.transWeight | threeBit}}吨</div>

                <div class="right fr" v-show="item.transBillStatus >= 60">成交价：{{item.actTransPrice | twoBit}}元／吨<span v-show="item.quoteType == 10">(一口价)</span> </div>

                <div class="right fr" v-show="item.transBillStatus < 60">单价：{{item.transPrice | twoBit}}元／吨 <span v-show="item.quoteType == 10">(一口价)</span> </div>

              </div>
              <div class="down clearfix" v-show="userType == 30">
                <div class="right fl">杂费：{{item.otherAmount}}</div>
                <div class="right fr" v-show="item.transBillStatus >= 60">成交金额：{{(item.actTransAmount*1).toFixed(2)}}</div>
                <div class="right fr" v-show="item.transBillStatus < 60">我的报价：{{(item.myTransPrice*1).toFixed(2)}}</div>
              </div>
              <div class="down clearfix" v-show="userType == 40">
                <div class="right fl">回单量：{{(item.actTransWeight*1).toFixed(3)}}</div>
                <div class="right fr">实时杂费：{{(item.actOtherAmount*1).toFixed(2)}}</div>
              </div>
            </div>
            <div class="clearfix dispatchBtnWrap">
              <span class="fl" @click='toDetail(item.transBillId)'>查看详情</span>
              <mt-button class='btn needsclick fr' type="primary" size="large"
                         @click.native='toDispatch(item.transBillId,item.transBillStatus)'
                         v-show="isShow(item.transBillStatus)">{{item.transBillStatus | transBillStatusBtn}}
              </mt-button>
              <mt-button class='btn needsclick fr' type="primary" size="large"
                         @click.native='toDispatchadjust(item.settleId,item.settleStatus)'
                         v-show="isShow(item.settleStatus)">调度调整
              </mt-button>
              <mt-button  v-show="item.transBillStatus >= 65 && item.countTrace > 0 " class='btn information fr' type="primary" size="large"
                         @click.native='toTrack(item.transBillId)'>物流信息
               </mt-button>
            </div>
          </div>
        </div>
        <div class="more_loading">
          <div v-show="showLoading">
            <mt-spinner type="snake" color="#00ccff" :size="10"></mt-spinner>
            <span>正在加载</span>
          </div>
          <span v-show="showALlLoad">已全部加载</span>
        </div>
      </div> -->
    </div>
    <m-tabbar :child-msg="msg"></m-tabbar>
    <!-- 筛选 -->
    <mt-popup v-model="searchPopup" popup-transition="popup-fade">
      <div class="searchWrap">
        <div class="head">
          <h3>筛选</h3>
          <span @click='closeSearchPopup'>×</span>
        </div>
        <div class="searCont">
          <ul class="list">
            <li>
              <p>运单号</p>
              <div class="iptDiv">
                <input type="text" placeholder="请输入运单号" v-model='transBillId'>
              </div>
            </li>
            <li>
              <p>时间区间</p>
              <div class="iptDiv timeGroup">
                <input type="text" placeholder="请选择日期" readonly v-model='beginTime' @click="openPicker(0)">
                <span>--</span>
                <input type="text" placeholder="请选择日期" readonly v-model='endTime' @click="openPicker(1)">
              </div>
            </li>
            <li>
              <p>运单量</p>
              <div class="iptDiv timeGroup">
                <input type="text" placeholder="请输入运单量" v-model='beginTransWeight'>
                <span>--</span>
                <input type="text" placeholder="请输入运单量" v-model='endTransWeight'>
              </div>
            </li>
            <li class="status">
              <p>状态</p>
              <ul class="clearfix">
                <li v-for="(item,index) in searchStatus"
                    :class="{active : searchStatusActive == index}"
                    @click="searchOnStatus(index,item)"
                    :key="index">{{item.txt}}
                </li>
                <!-- 			<li class="active">全部</li>
                              <li>待调度</li>
                              <li>已返单</li>
                              <li class="colLast">已送达</li>
                              <li>返单待确定</li>
                              <li>运输完成</li>
                              <li class="colLast">结算完成</li> -->
              </ul>
            </li>
          </ul>
        </div>
        <div class="foot clearfix">
          <a href="javascript:;" class="fl" @click="toReset">重置</a>
          <a href="javascript:;" class="fr" @click="tosearch">完成</a>
        </div>
      </div>
    </mt-popup>
    <!-- 底部打开日期 -->
    <mt-datetime-picker
      ref="startPicker"
      type="datetime"
      v-model="pickerValue"
      @confirm="start">
    </mt-datetime-picker>
  </div>
</template>
<script type="text/ecmascript-6">
  import Vue from 'vue'
  import ApiService from '@/services/API-servies'
  import {mapMutations, mapActions,mapGetters} from 'vuex';
  import {
    Tabbar,
    TabItem,
    Cell,
    TabContainer,
    TabContainerItem,
    Button,
    InfiniteScroll,
    Indicator,
    Spinner,
    Popup,
    DatetimePicker,
    MessageBox,
    Loadmore
  } from 'mint-ui';
  import MTabbar from '../foot/Tabbarfoot'
  import CountDown from '../public/public.vue'
  import { swiper, swiperSlide } from 'vue-awesome-swiper'
  import 'swiper/dist/css/swiper.css'
  import MtSwiperTransSlideCont from './MtSwiperTransSlideCont'

  Vue.use(InfiniteScroll);
  export default {
    data() {
      return {
        statusList: [{
          status: '0',
          txt: '全部订单',
          count:'',
        }, {
          status: '60',
          txt: '待调度',
          count:'0',
        }, {
          status: '65',
          txt: '已派运',
          count:'0',
        }, {
          status: '68',
          txt: '已送达',
          count:'0',
        }],
        statusListDriver: [{
          status: '0',
          txt: '全部订单',
          count:'',
        }, {
          status: '65',
          txt: '已派运',
          count:'0',
        }, {
          status: '68',
          txt: '已送达',
          count:'0',
        }],
        statusListAll:[],
        searchStatusActive: '',
        searchStatus: [{
          status: '0',
          txt: '全部',
        }, {
          status: '60',
          txt: '待调度',
        }, {
          status: '65',
          txt: '已派运',
        }, {
          status: '68',
          txt: '已送达',
        }, {
          status: '70',
          txt: '返单待确定',
        }, {
          status: '80',
          txt: '运输完成',
        }, {
          status: '95',
          txt: '结算完成',
        }],
        statusActive: '',
        loadList: [],
        session: '',
        setUserInfo2: '',
        timeTit: '',
        bidTime: '',
        bidTimeList: [],
        msg: 'transport',
        list: {
          '0':[],
          '60':[],
          '65':[],
          '68':[],
        },
        listDrav:{
          '0':[],
          '65':[],
          '68':[],
        },
        sortFlog: true,//默认是按照正序价格排列
        priceChecked: 'all',//默认选中的价格范围
        busy: true,//默认允许滚动执行loadMore函数
        pageNo: 1,//默认分页为第一页
        pageSize: 10,//默认每页显示8条数据
        flag: false,//默认没有分页
        showLoading: false,
        showALlLoad: false,
        userType: '30',
        searchPopup: false,
        beginTime: '',
        endTime: '',
        transBillId: '',
        beginTransWeight: '',
        endTransWeight: '',
        pickerValue: new Date(),
        endPickerValue: new Date(),
        timeType:'',
        status:'',
        aaa:'',
        parameterState:'',
        checkStatus:'',
        allLoaded:false,
        wrapperHeight:0,
        topStatus:'',
        scrollMode:'auto',
        bottomText:'上拉加载更多...',
        swiperOption: {
          initialSlide:0,
          notNextTick: true,
          pagination: '.swiper-pagination',
          paginationClickable: true,
          mousewheelControl: true,
          observer:true,
          observeParents: true,
          passiveListeners: false,
            onSlideChangeEnd: swiper => {
              this.loadListFun(this.statusActive,false,true);
              if(this.userType == 30){
                switch (swiper.activeIndex) {
                  case 0:
                    this.statusActive='0'
                    break;
                  case 1:
                    this.statusActive='60'
                    break;
                  case 2:
                    this.statusActive='65'
                    break;
                  case 3:
                    this.statusActive='68'
                    break;
                  default:
                    break;
                };
                localStorage.setItem('localTransStatusCarrier',this.statusActive);
              }else if(this.userType == 40){
                switch (swiper.activeIndex) {
                  case 0:
                    this.statusActive='0'
                    break;
                  case 1:
                    this.statusActive='65'
                    break;
                  case 2:
                    this.statusActive='68'
                    break;
                  default:
                    break;
                };
                localStorage.setItem('localTransStatusDriver',this.statusActive);
              }
          },
        },
      }
    },
    computed:{
      ...mapGetters(['getTransportStatus'])
    },
    created() {
      window.setWaybill = this.setWaybill;
      window.clickSearch = this.clickSearch;
      //this.loadListFun();// 浏览器测试
      // this.toLoadListFun();//测试
      // this.setUserType(this.userType);
     //this.queryCount();
    },
    mounted() {
      let _this = this;
      setTimeout(() => {
        if (this.$isBrower.isAndroid) {
          this.getAndWay();
          this.setAndTitleType();
        } else if (this.$isBrower.isIos) {
          this.iosSetWaybill();
          this.setIosTitleType();
          this.iosSearch();
        }
      }, 0)
      this.queryCount();
    },
     computed: {
      swiper() {
        return this.$refs.mySwiper.swiper
      }
    },
    methods: {
      ...mapActions(['setUserType']),
      // ...mapActions(['setUserType','setTransportStatus']),
      loadTop() {
        this.pageNo = 1;
        this.loadListFun(this.statusActive,false,true);
      },
      loadBottom() {
        this.pageNo++;
        this.loadListFun(this.statusActive,true);
    },
    handleTopChange(status) {
      this.topStatus = status;
    },
    getIndex(){
        let index;
        let sta=this.statusActive;
        if(sta == '') sta='0';
        if(this.userType == 30){
          switch (sta) {
            case '0':
              index=0
              break;
            case '60':
              index=1
              break;
            case '65':
              index=2
              break;
            case '68':
              index=3
              break;
            default:
              break;
          }
        }else if(this.userType == 40){
          switch (sta) {
            case '0':
              index=0
              break;
            case '65':
              index=1
              break;
            case '68':
              index=2
              break;
            default:
              break;
          }
        }
        return index
      },
      loadListFun(status,flag,on) {
        if(!flag){
          this.pageNo = 1
        };
        this.showLoading = true;
        this.showALlLoad = false;
        let sta = status;
        if(sta == 0 && '' == this.parameterState) {
          sta='';
        }else if(this.statusActive == 0 && '' != this.parameterState){
          sta = this.parameterState;
        }

        let params = {
          pageSize: this.pageSize,
          pageNo: this.pageNo,
          status: sta,
          endTime: this.endTime,
          beginTime: this.beginTime,
          transBillId: this.transBillId,
          beginTransWeight: this.beginTransWeight,
          endTransWeight: this.endTransWeight,
          source:'app',
        }
        let index = this.getIndex();
        if (this.userType == 30) {
          ApiService.transport.load(params).then((res) => {
            this.showLoading = true;
            if (flag && this.userType == 30) {//判断是否通过分页
              this.list[status] = this.list[status].concat(res.data.list);//分页数据追加到这个list里面
              if (res.data.list.length < 10) {//判断数是否加载完成，就让数据截停
                this.busy = true;
                this.showLoading = false;
                this.showALlLoad = true;
              } else {
                this.busy = false;
              }
              for(let i=0;i<4;i++){
                this.$refs.loadmore[i].onBottomLoaded();
              }
            } else if (this.userType == 30) {
              this.list[status] = res.data.list;
              this.busy = false;
              if (res.data.list.length < 10) {//判断数是否加载完成，就让数据截停
                this.busy = true;
                this.showLoading = false;
                this.showALlLoad = true;
              }
              if(on){
                for(let i=0;i<4;i++){
                  this.$refs.loadmore[i].onTopLoaded();
                }
              }
            }
            this.wrapperHeight = document.documentElement.clientHeight - 116;
          });
        } else if (this.userType == 40) {
          ApiService.driver.load(params).then((res) => {
            this.showLoading = true;
            if (flag && this.userType == 40) {//判断是否通过分页
              this.listDrav[status] = this.listDrav[status].concat(res.data.list);//分页数据追加到这个list里面
              if (res.data.list.length == 0) {//判断数是否加载完成，就让数据截停
                this.busy = true;
                this.showLoading = false;
                this.showALlLoad = true;
              } else {
                this.busy = false;
              }
              for(let i=0;i<3;i++){
                this.$refs.loadmore[i].onBottomLoaded();
              }
            } else if (this.userType == 40) {
              this.listDrav[status] = res.data.list;
              this.busy = false;
              if (res.data.list.length < 10) {//判断数是否加载完成，就让数据截停
                this.busy = true;
                this.showLoading = false;
                this.showALlLoad = true;
              }
              if(on){
                for(let i=0;i<3;i++){
                  this.$refs.loadmore[i].onTopLoaded();
                }
              }
            }
            this.wrapperHeight = document.documentElement.clientHeight - 116;
          });
        }
      },
      loadMore: function () {
        this.busy = true;
        setTimeout(() => {
          this.pageNo++;
          // this.loadListFun(true);
        }, 500)
      },
      onStatus(re) {
        this.parameterState = '';//清空条件参数
        this.status = this.statusActive = re;
        this.checkStatus = re;
        if(this.userType == 30){
          localStorage.setItem('localTransStatusCarrier',this.statusActive); //切换状态保存本地
        }else if(this.userType == 40){
          localStorage.setItem('localTransStatusDriver',this.statusActive);
        }
        // this.list = [];
        // this.pageNo = 1;
        // this.loadListFun();
        this.pageNo = 1;
        this.loadListFun(this.statusActive,false,true);
        let index = this.getIndex();
        this.swiper.activeIndex = index;
        this.queryCount();
      },
      searchOnStatus(index, item) {
        this.searchStatusActive = index; // 搜索框中状态选中
        this.status = item.status; // 接口状态值
        this.parameterState = item.status;
      },
      toDetail(transBillId) {
        // this.setTransportStatus(this.statusActive);
        // this.$router.push({path: 'transportDetail', query: {transBillId: transBillId,setTransportStatus:this.statusActive}})
        if (this.userType == 30) {
          this.$router.push({path: 'transportDetail', query: {transBillId: transBillId}})
        } else {
          this.$router.push({path: 'driverTransportDetail', query: {transBillId: transBillId}})
        }
      },
      toDispatchAdjust(transBillId, _status){
        if (_status == 65) {
          this.$router.push({path: 'dispatch', query: {transBillId: transBillId, ud: 1}});//调度调整
        }
      },
      toDispatch(transBillId, _status) {
        //暂时写承运商
        if (_status == 60) {
          this.$router.push({path: 'dispatch', query: {transBillId: transBillId, ud: 0}});//调度新增
        }
        if (_status == 65) {
          this.arrived(transBillId);
        }
        if (_status == 68 || _status == 74) {
          //暂时注释掉
          if (this.userType == 30) {
            this.$router.push({path: 'receipt', query: {transBillId: transBillId}})
          } else {
            this.$router.push({path: 'receiptCarrier', query: {transBillId: transBillId}})
          }
          //this.$router.push({path:'receipt', query: {transBillId:transBillId,time:new Date()}})
        }
      },
      toTrack(transBillId){
        this.$router.push({path:'track',query: {transBillId: transBillId}})
      },
      getAndWay() {
          app.setWaybill();
      },
      setWaybill(userType) {
        this.userType = userType;
        this.setUserType(this.userType);
        if(this.$route.query.statusActive && this.checkStatus == ''){ //默认优先获取url后缀
          //如果是承运商或者司机自己本身的状态
          let _statusActic = this.$route.query.statusActive;
          let _myType = this.$route.query.myType;
          this.statusActive = '0';
          if(userType == 30 && _myType == 30){
            this.status = _statusActic;
            if(_statusActic == '60'){
              this.statusActive = _statusActic;
            }else if(_statusActic == '65'){
              this.statusActive = _statusActic;
            }
            
            localStorage.setItem('localTransStatusCarrier',''); //清空原有数据
          }else if(userType==40 && _myType == 40){
            this.status = this.$route.query.statusActive;
            localStorage.setItem('localTransStatusDriver','');
          }else{
            this.status = '';
          }
          this.parameterState = this.status;
        }else{
          let re = '';
          if(this.userType == 30){
            re = localStorage.getItem('localTransStatusCarrier');//获取本地承运商状态

          }else if(this.userType == 40){
            re = localStorage.getItem('localTransStatusDriver');
          }
          // if(!re){
          //   re =''
          // }
          this.status = this.statusActive = re;
          if(this.statusActive == ''){
            this.statusActive = '0'
          }
          this.parameterState = '';//切换清空参数条件
        };
        //this.aaa = "status ==="+this.status+"======this.statusActive=="+this.statusActive;
        // this.list = [];
        // this.pageNo = 1;

        this.toLoadListFun();
      },
      setAndTitleType() {
        app.setTitleType({
          isReturn: false,
          isSearch: true
        });
      },
      isShow(val) {
        if (val == 60) {
          return true;
        } else if (val == 65) {
          return true;
        } else if (val == 68 || val == 74) {
          return true;
        }
        return false;
      },
      childRes(transBillId){
        this.arrivedResLoad(transBillId);
      },
      arrivedResLoad(transBillId){
        if(this.userType == '30'){
                ApiService.transport.arrived({
                  transBillId: transBillId
                }).then((res) => {
                  if (res.meta.retCode === '0') {
                    MessageBox('提示', '操作成功').then(action =>{
                      if(action == 'confirm'){
                        // this.list[this.statusActive] = [];
                        this.pageNo = 1;
                        this.loadListFun(this.statusActive,false,true);
                        // this.status = 65;
                        // this.loadListFun();
                      }
                      this.queryCount();
                    });
                  }
                });
              }else{
                ApiService.driver.delivered({
                    transBillId:transBillId
                }).then((res) =>{
                     if(res.meta.retCode === '0'){
                        MessageBox('提示', '操作成功').then(action =>{
                          if(action == 'confirm'){
                            this.list = [];
                            this.pageNo = 1;
                            this.status = 65;
                            // this.loadListFun();
                          }
                          this.queryCount();
                      });
                     }
                });
              }
      },
      arrived(transBillId) {
        //承运商已送达
        /**/
        MessageBox({
          title: '提示',
          message: '确定执行此操作?',
          showCancelButton: true
        }).then(action => {
          if (action == 'confirm') {
            if(this.userType == '30'){
                ApiService.transport.arrived({
                  transBillId: transBillId
                }).then((res) => {
                  if (res.meta.retCode === '0') {
                    MessageBox('提示', '操作成功').then(action =>{
                      if(action == 'confirm'){
                        this.list = [];
                        this.pageNo = 1;
                        this.status = 65;
                        // this.loadListFun();
                      }
                      this.queryCount();
                    });
                  }
                });
              }else{
                ApiService.driver.delivered({
                    transBillId:transBillId
                }).then((res) =>{
                     if(res.meta.retCode === '0'){
                        MessageBox('提示', '操作成功').then(action =>{
                          if(action == 'confirm'){
                            this.list = [];
                            this.pageNo = 1;
                            this.status = 65;
                            // this.loadListFun();
                          }
                          this.queryCount();
                      });
                     }
                });
              }
          } else if (action == 'cancel') {
            console.log('取消')
          }
        })
      },closeSearchPopup(){
         this.toReset();
         this.searchPopup = false;
      },
      // andriod 搜索方法
      clickSearch() {
        this.searchPopup = true;
      },
      //ios 搜索方法
      iosSearch() {
        this.$bridge.registerhandler('searchPopup', (data) => {
          this.searchPopup = true;
        })
      },
      //ios 设置头部信息
      setIosTitleType(){
        let params = {
          isReturn: false,
          isSearch: true,
          isTitleSegment:true
        };
        this.$bridge.callhandler('needBarButton', params, (data) => {})
      },
      // ios 切换title （司机，承运商）
      iosSetWaybill(){
        this.$bridge.registerhandler('tellUserType', (userType) => {
          this.userType = userType;
          this.setUserType(this.userType);

          //加获取状态
          if(this.$route.query.statusActive && this.checkStatus == ''){ //默认优先获取url后缀
          //如果是承运商或者司机自己本身的状态
          let _statusActic = this.$route.query.statusActive;
          let _myType = this.$route.query.myType;
          if(userType == 30 && _myType == 30){
            this.status = this.$route.query.statusActive;
            localStorage.setItem('localTransStatusCarrier',''); //清空原有数据
          }else if(userType==40 && _myType == 40){
            this.status = this.$route.query.statusActive;
            localStorage.setItem('localTransStatusDriver','');
          }else{
            this.status = '';
          }
          this.statusActive = '0';
          this.parameterState = this.status;
        }else{
          let re = '';
          if(this.userType == 30){
            re = localStorage.getItem('localTransStatusCarrier');//获取本地承运商状态
          }else if(this.userType == 40){
            re = localStorage.getItem('localTransStatusDriver');
          }
          if(!re){
            re =''
          }
          this.status = this.statusActive = re;
          if(this.statusActive == ''){
            this.statusActive = '0'
          }
        };

          // this.list = [];
          this.pageNo = 1;
          this.toLoadListFun();
        })
      },
      tosearch() {
        this.statusActive = '0'; // 重置列表head状态
       // this.pageNo = 1;
       // this.list = [];
       // this.toLoadListFun();
        this.searchPopup = false;
        this.pageNo = 1;
        this.loadListFun(this.statusActive,false,true);
        this.swiper.activeIndex = 0;
      },
      toLoadListFun(){
        // this.setUserType(this.userType)//测试
        let statusList;
        if(this.userType == 30){
          this.statusListAll = this.statusList;
          statusList = this.statusList;
        }else if(this.userType == 40){
          this.statusListAll = this.statusListDriver;
          statusList = this.statusListDriver;
        }
        for(let i in statusList){
         this.loadListFun(statusList[i].status);
        };
        let index = this.getIndex();
        this.swiper.activeIndex = index;
      },
      toReset() {
        this.beginTime = '';
        this.endTime = '';
        this.transBillId = '';
        this.beginTransWeight = '';
        this.endTransWeight = '';
        this.statusActive='0';
        this.swiper.activeIndex = 0
      },
      openPicker(type) {
        this.timeType = type;
        this.$refs.startPicker.open();
      },
      openEndPicker() {
        this.$refs.endPicker.open();
      },
      start(value) {
        let start = this.$moment(value).format("YYYY-MM-DD HH:mm");
        if(this.timeType == 0){
          this.beginTime = start;
        }else if(this.timeType == 1){
          this.endTime = start;
        }
      },
      end(value) {
        let end = this.$moment(value).format("YYYY-MM-DD HH:mm");
        this.offerForm.deliveryTime = end;
      },
      toChange(rose){
        this.userType = rose;
        this.setUserType(rose);
      },
      queryCount() {
        for (var i = this.statusList.length - 1; i >= 0; i--) {
            let _statusObj = this.statusList[i];
            let sta = _statusObj.status==0?'':_statusObj.status;
             ApiService.transport.waybills({
                status: sta
              }).then((res) => {
                if (res.meta.retCode === '0') {
                  _statusObj.count = res.data;
                }
            });
        }
        for (var i = this.statusListDriver.length - 1; i >= 0; i--) {
            let _statusDriverObj = this.statusListDriver[i];
            let sta = _statusDriverObj.status==0?'':_statusDriverObj.status;
             ApiService.driver.waybills({
                status: sta
              }).then((res) => {
                if (res.meta.retCode === '0') {
                  _statusDriverObj.count = res.data;
                }
            });
        }
      }
    },
    filters: {
      status(val) {
        if (val == 30) {
          return '待竞价'
        } else if (val == 40) {
          return '参与竞价'
        }
      },
    /*  city(val) {
        var index = val.indexOf('-') + 1;
        return val.substring(index)
      },*/
      transBillStatusBtn(val) {
        if (val == 60) {
          return '指派车/船'
        } else if (val == 65) {
          return '已送达'
        } else if (val == 68 || val == 74) {
          return '回单上传'
        }
      }
    },
    components: {
      MtTabbar: Tabbar,
      MtTabItem: TabItem,
      mtCell: Cell,
      MtTabContainer: TabContainer,
      MtTabContainerItem: TabContainerItem,
      MTabbar,
      MtButton: Button,
      CountDown,
      MtSpinner: Spinner,
      MtPopup: Popup,
      MtDatetimePicker: DatetimePicker,
      MtLoadmore: Loadmore,
      swiper,
      swiperSlide,
      MtSwiperTransSlideCont
    }
  }
</script>

<style lang="less" rel="stylesheet/less">
  @import "~common/less/variable";

  .transportWrap {
    .wrapCont {
      padding: 0px 0 112px;
      .main-body{
        overflow: scroll;
        -webkit-overflow-scrolling:touch;
        margin-top: 120px;
      }
      .header {
        position: fixed;
        width: 100%;
        z-index: 99;
        background: #fff;
        padding-top: 20px;
        margin-bottom: 10px;
        box-shadow: 0px 4px 10px 0px rgba(183,186,199,0.5);
        overflow-x: auto;
        ul {
          li {
            float: left;
            width: 25%;
            text-align: center;
            &.driverLi {
              width: 33.33%;
            }
            p {
              font-size: 28px;
              color: #5C6063;
              margin-bottom: 10px;
              &.active {
                color: @blue
              }
              span{
                color: red
              }
            }
            i {
              display: block;
              margin: 0 auto;
              width: 60%;
              height: 6px;
              background: @blue;
            }
          }
        }
      }
      .contant{
        padding-top: 120px;
      }
      .offerList {
        font-size: 26px;
        padding: 10px 20px;
        .singerBox {
          background: #fff;
          padding: 30px;
          padding-bottom: 10px;
          border-radius: 16px;
          box-shadow: 0px 4px 10px 0px rgba(183,186,199,0.5);
          .boxTitle {
            margin-bottom: 12px;
            .left {
              line-height: 34px;
              color: #999;
            }
            .right {
              background: #5395FF;
              color: #fff;
              padding: 8px 12px;
              border-radius: 200px;
              font-size: 24px;
              font-weight: 400;
              line-height: 28px;
              &.date{
                line-height: 34px;
                color: #999;
                display: inline;
                font-size: 26px;
                font-weight: 400;
                padding: 0;
                background: transparent;
              }
            }
          }
          .address {
            font-size: 32px;
            font-weight: 800;
            position: relative;
            & span {
              font-weight: 500
            }
            .iconTo {
              display: inline-block;
              width: 60px;
              position: absolute;
              left: 50%;
              background: url(../../common/imgs/iconTo.png) no-repeat center;
              background-size: 100%;
              transform: translateX(-50px)
            }
            .add {
              width: 267px;
              overflow: hidden;
              text-overflow: ellipsis;
              white-space: nowrap;
            }
          }
          .info {
            font-size: 26px;
            color: #666;
            margin-bottom: 6px;
            line-height: 40px;
            .down {
              margin-top: 10px;
              span {
                color: #FF0505
              }
            }
          }
          .border {
            border-top: 3px dashed #E8E7E8;
            height: 3px;
            margin: 20px 0;
            position: relative;
            .halfLe{
              display: block;
              position: absolute;
              left: -44px;
              top:-20px;
              width: 40px;
              height: 40px;
              background: url(../../common/imgs/harfLe.png) no-repeat center center;
              background-size: contain;
            }
            .halfRi{
              display: block;
              position: absolute;
              right: -44px;
              top:-20px;
              width: 40px;
              height: 40px;
              background: url(../../common/imgs/harfRi.png) no-repeat center center;
              background-size: contain;
            }
          }
          .dispatchBtnWrap {
            text-align: right;
            .fl {
              color: @blue;
              font-size: 26px;
              line-height: 60px;
            }
            .btn {
              width: 180px;
              font-size: 28px;
              line-height: 30px;
              height: 52px;
              border-radius: 8px;
              background: @blue
            }
            .information {
              margin-right : 20px;
            }
          }
        }
      }
      .more_loading {
        text-align: center;
        .mint-spinner-snake {
          display: inline-block;
          vertical-align: middle;
          margin-right: 10px
        }
      }
      .mailingAddress{
        position: fixed;
        bottom: 0;
        width: 100%;
        background: #fff6d2;
        color: #000;
        text-align: center;
        font-size: 28px;
        line-height: 60px;
      }
    }
    .searchWrap{
      width: 660px;
      text-align: center;
      .head {
        h3 {
          color: #F9F3F3;
          line-height: 88px;
          font-size: 36px;
          background: @blue;
        }
        span {
          position: absolute;
          top: 26px;
          right: 20px;
          width: 56px;
          height: 56px;
          line-height: 48px;
          font-size: 56px;
          color: #F9F3F3
        }
      }
      .searCont {
        background: #fff;
        max-height: 560px;
        overflow:auto;
        .list {
          margin: 0 30px;
          text-align: left;
          p {
            font-size: 28px;
            color: #333;
            font-weight: 400;
          }
          .iptDiv {
            background: #F0F2F5;
            padding: 14px;
            line-height: 10px;
            input {
              color: #333;
              font-size: 26px;
              height: 56px;
              width: 99%;
            }
            ::-webkit-input-placeholder { /* WebKit browsers */
              color: #BBBBBB;
            }
            &.timeGroup {
              span {
                color: #C1C1C1;
                font-weight: 800
              }
              input {
                width: 254px;
              }
            }
          }
          .status {
            li {
              position: relative;
              float: left;
              color: #999;
              font-size: 26px;
              padding: 4px 30px;
              background: #F0F2F5;
              margin-right: 18px;
              margin-bottom: 20px;
              display: inline-block;
              border-radius: 8px;
              border: 2px solid #F0F2F5;
              &:nth-child(4), &:nth-child(7) {
                margin-right: 0;
              }
              &.active {
                border: 2px solid #2F7AF3;
                color: #2F7AF3
              }
              &.active:after {
                content: "";
                position: absolute;
                bottom: 0;
                right: 0;
                width: 36px;
                height: 32px;
                background: url(../../common/imgs/check.png) no-repeat 0 0;
                background-size: 100%;
              }
            }
          }
        }
      }
      .foot {
        background: #fff;
        border-top: 2px solid #D8D8D8;
        padding: 10px 20px 0;
        margin: 0;
        a {
          display: block;
          width: 300px;
          height: 80px;
          background: @blue;
          color: #fff;
          font-weight: 400;
          font-size: 32px;
          line-height: 80px;
          text-align: center;
          border-radius: 8px;
          margin: 30px auto;
        }
      }
    }
    .clickH5Btn2 {
      margin-top: 20px
    }
  }
  .mint-indicator-wrapper{
    z-index: 9999999
  }
</style>















